<template>
  <div class='drawer-page-root'>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="name" label="键">
        <template slot-scope="scope">
          <el-input v-model="scope.row.name"></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="value" label="值">
        <template slot-scope="scope">
          <el-input v-model="scope.row.value"></el-input>
        </template>
      </el-table-column>
    </el-table>
    <div class="footer">
      <el-button type="primary" @click="handleSubmit">确定</el-button>
      <el-button @click="() => $emit('close')">取消</el-button>
    </div>
  </div>
</template>
<script>
export default {
  name: 'DrawerPage',
  components: {},
  props: {
    activeData: {
      type: Object,
      default: () => ({})
    }
  },
  data () {
    return {
    }
  },
  computed: {
    tableData(){
      return this.activeData?.chartData || []
    }
  },
  created () {

  },
  mounted () {

  },
  methods: {
    handleSubmit () {
      this.$emit('submit', this.tableData)
    }
  }
}
</script>
<style scoped lang='scss'>
.drawer-page-root {
  width: 100%;
  height: 100%;
  position: relative;

  .footer {
    display: flex;
    justify-content: space-between;
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 10px;
  }
}
</style>